package br.com.bestOffer.util;
import java.io.ByteArrayInputStream;
import java.io.IOException;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;

import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;

@ManagedBean
@ViewScoped
public class ImageStreamer {


	    public StreamedContent getImage() throws IOException {
	        FacesContext context = FacesContext.getCurrentInstance();

	            String imagem = context.getExternalContext().getRequestParameterMap().get("imagem");
	            return new DefaultStreamedContent(new ByteArrayInputStream(imagem.getBytes()));
	        }

	
}
